import { Status, BaseFilter } from './base';

// 租户品牌设置
export interface TenantBranding {
  logo?: string;
  primaryColor?: string;
  secondaryColor?: string;
  favicon?: string;
  companyName?: string;
}

// 租户设置
export interface TenantSettings {
  maxUsers: number;
  maxOrganizations: number;
  maxStorage: number; // MB
  features: string[];
  customDomain?: string;
  branding?: TenantBranding;
  allowCrossTenant: boolean;
  dataRetentionDays: number;
}

// 租户实体
export interface Tenant {
  id: string;
  name: string;
  code: string;
  status: Status;
  subscriptionPlan: string;
  subscriptionPlanId: string;
  settings: TenantSettings;
  contactInfo?: {
    email?: string;
    phone?: string;
    address?: string;
    website?: string;
  };
  adminUserId?: string;
  expiresAt?: string;
  createdAt: string;
  updatedAt: string;
  createdBy?: string;
  updatedBy?: string;
}

// 租户查询过滤器
export interface TenantFilter extends BaseFilter {
  subscriptionPlan?: string;
  adminUserId?: string;
  expiring?: boolean; // 即将到期
}

// 租户表单数据
export interface TenantFormData {
  name: string;
  code: string;
  status: Status;
  subscriptionPlanId: string;
  settings: Partial<TenantSettings>;
  contactInfo?: {
    email?: string;
    phone?: string;
    address?: string;
    website?: string;
  };
  adminUserId?: string;
  expiresAt?: string;
}

// 创建租户请求
export interface CreateTenantRequest extends TenantFormData {}

// 更新租户请求
export interface UpdateTenantRequest extends Partial<TenantFormData> {}

// 租户统计信息
export interface TenantStats {
  id: string;
  name: string;
  userCount: number;
  organizationCount: number;
  storageUsed: number; // MB
  lastActiveAt?: string;
  subscriptionStatus: 'active' | 'expired' | 'trial';
  daysToExpiry?: number;
}